export default {
	install: function(Vue, options) {

		//跨域请求
		Vue.prototype.$tldJsonp = function(options) {
				if(options.isLayer) {
					this.$store.commit('increment');
				}
				this.$http.jsonp(options.url, {
					params: options.params
				}).then((response) => {
					if(options.isLayer) {
						this.$store.commit('increment')
					}
					if(response.data.success) {
						//成功回调
						if(options.successFc && typeof(options.successFc) == "function") {
							options.successFc(response);
						}
					} else {
						this.$Message.error(response.data.msg)
						//失败回调
						if(options.failFc && typeof(options.failFc) == "function") {
							options.failFc(response);
						}
					}
				}, (response) => {
					if(options.isLayer) {
						this.$store.commit('increment')
					}
					//没有登陆
					this.$Message.error('登录过期,即将跳转登陆');
					this.$router.push({
						path: '/'
					});
					//					if(response.status == '403') {
					//						//没有登陆
					//						this.$ydkTips({
					//							tips: '登录过期,即将跳转登陆'
					//						});
					//						this.$router.push({
					//							path: '/wxvue/coachLogin/0'
					//						})
					//					}
				});
			},

			Vue.prototype.$domain = 'http://localhost:8081';
	}
};